<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>
                       <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <form class="form-inline"  id="formId">
                               
                                <label class="inline">员工搜索:</label>
                                
                                <input type="text" name="name" class="form-control">
                                <!-- <input type="hidden" name="x_type" value="1" class="form-control"> -->
                               
                                <div  class="btn btn-purple btn-sm" onclick="sou()">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    Search
                                </div>
                                 <!-- <div class='btn btn-info' id='bfan' style='width:100px;height:30px;line-

height:10px;display:none;'>返回上一级</div> -->
                                 <div class='btn btn-info' id='bfen' style='width:120px;height:30px;line-height:10px;display:none;'>返回</div>
                            </form>
                        </div>
                        <div class="space-4"></div>
                        <div class="row">
                            <form id="form" method="post" action="">
                                <table class="table table-striped table-bordered table-hover" id="tet">
                                    <thead>
                                    <tr>
                                        <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                        <th class="center">姓名</th>
                                        <th class="center">所属部门</th>
                                        <th class="center">性别</th>
                                        <th class="center">工号</th>
                                        <th class="center">职务类型</th>
                                        <th class="center">上级</th>
                                        <th class="center">负责项目</th>
                                        <th class="center">入职时间</th>
                                        <th class="center">转正时间</th>
                                        <th class="center">在职情况</th>
                                       <!--  <th>电话</th>
                                        <th>Q&nbsp;Q</th>
                                        <th>邮箱</th> -->
                                        <th class="center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <style>
                                        .grouptd {
                                            position: relative;
                                        }

                                        .group {
                                            display: inline-block;
                                            width: 100%;
                                        }

                                        .groupselect {
                                            position: absolute;
                                            top: 0;
                                            left: 0;
                                            width: 100%;
                                            height: 100%;
                                            border: 0;
                                        }
                                    </style>
                                    <volist name="list" id="val">
                                        <tr>
                                            <td class="center">
                                                <if condition="$val['uid'] neq 1"><input class="uids" type="checkbox"
                                                                                         name="uids[]"
                                                                                         value="{$val['uid']}">
                                                    <else/>
                                                    <span title="系统管理员，禁止删除">--</span></if>
                                            </td>
                                            <td>{$val['user']}</td>
                                            <td class="grouptd">
                                                <span class="group" val="{$val['uid']}">{$val['post']}</span>
                                                <select class="groupselect hide">
                                                    <volist name="group" id="v">
                                                        <option
                                                        <if condition="$val['gid'] eq $v['id']">selected="selected"</if>
                                                        value="{$v.id}">{$v.post}</option>
                                                    </volist>
                                                </select>
                                            </td>
                                            <td class="center"><?php if($val['sex']==1){echo '男';}elseif($val['sex']==2){echo '女';}else{echo '保密';} ?></td>
                                            <td class="center">{$val.ghao}</td>
                                            <td class="center"><?php if($val['z_type']==0){echo '管理岗位';}elseif($val['z_type']==1){echo '职员';}else{echo '保密';} ?></td>
                                            <td class="center">{$val['lead']}</td>
                                            <td class="center">{$val['project']}</td>
                                            <td class="center">{$val['r_time']}</td>
                                            <td class="center">{$val['z_time']}</td>
                                            <td class="center"><?php if($val['type']==0){echo '在职';}elseif($val['type']==1){echo '离职';}else{echo '保密';} ?></td>
                                            <td class="center"><a href="{:U('edit',array('uid'=>$val['uid']))}">修改</a>&nbsp;
                                                <if condition="$val['uid'] neq 1"><a onclick="del({$val.uid},this)">删除</a></if>
                                            </td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                            </form>
                           
                            {$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
             
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script src="__PUBLIC__/layer/layer.js"></script>
<script type="text/javascript">



 //办公用品搜索
    function sou()
    {
       
        $.ajax({
            type: "POST",
            url:"{:U('User/sou')}",
            data:$('#formId').serialize(),// 要提交的表单 
            success: function(data) {
                // console.log(data);
                 if (data != 1111) {
                    $('td').remove();
                        
                    for (var i = 0; i < data.length; i++) {
                        // console.log(data);
                        $("<tr><td></td><td class='center'>"+data[i].user+"</td><td class='center'>"+data[i].post+"</td><td class='center'><if condition='"+data[i].sex+" eq 1'>男<else />女</if></td><td class='center'>"+data[i].ghao+"</td><td class='center'><if condition='"+data[i].z_type+" eq 0'>职员<else />管理员</if></td><td class='center'>"+data[i].lead+"</td><td class='center'>"+data[i].project+"</td><td class='center'>"+data[i].r_time+"</td><td class='center'>"+data[i].z_time+"</td><td class='center'><if condition='"+data[i].type+" eq 0'>在职<else />离职</if></td><td class='center'><a href='{:U('edit',array('uid'=>$val['uid']))}'>修改</a>&nbsp&nbsp<a onclick='del("+data[i].id+",this)'>删除</a></td></tr>").appendTo('#tet');
                        $('#bfan').show();
                        $('#bfen').show();
                    }
                  
                    
               }else{
                    $('td').remove();
                    $("<td class='center' colspan='10' id='bmei'><h2>没有搜索到!!!</h2></td>").appendTo('#tr');
                    // $('#bfan').show();
                    $('#bfen').hide();
               }
               
              
            }
        });
    }

$('#bfen').click(function(){
    history.go(0); 
})


function del(id,obj)
{


    //询问框
    layer.confirm('确定删除么 ( ・◇・)？', {
      btn: ['确定','取消'] //按钮
    }, function(){
         $.ajax({
             type: "POST",
             url:"{:U('User/del')}",
             data:{'id':id},
             beforeSend:function(){
                    layer.load(0, {shade: false});
                },
             success: function(msg) {
                if (msg == 1111) {
                    layer.msg('删除成功', {icon: 1});
                    history.go(0); 
                }else{
                    layer.msg('删除失败!');
                }
             },
             complete: function() {
                     layer.closeAll('loading');
                }
        });
     
    }, function(){
        layer.msg(' (｡・`ω´･) 再见');
    });
    
}
</script>
</body>
</html>
